package org.csu.jpetmanage.service.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.csu.jpetmanage.mapper.ProfileMapper;
import org.csu.jpetmanage.model.Profile;
import org.csu.jpetmanage.service.ProfileService;
import org.springframework.stereotype.Service;

@Service
public class ProfileServiceImpl extends ServiceImpl<ProfileMapper, Profile> implements ProfileService {
    @Override
    public Page<Profile> profilelist(Profile profile, long current, long size) {
        QueryWrapper<Profile> queryWrapper = new QueryWrapper<>();
        if (null != profile.getUserid()) {
            queryWrapper.eq("userid", profile.getUserid());
            queryWrapper.like("la", profile.getLa());
            queryWrapper.like("fa", profile.getFa());
        }

        return baseMapper.selectPage(new Page<>(current, size), queryWrapper);
    }
}
